#pragma once
#include <pthread.h>

class Mutex
{
private:
    pthread_mutex_t* _mutex;

public:
    Mutex(pthread_mutex_t* lock)
    :_mutex(lock)
    {
    }
    void Lock()
    {
        pthread_mutex_lock(_mutex);
    }
    void Unlock()
    {
        pthread_mutex_unlock(_mutex);
    }
    ~Mutex()
    {
    }
};

class LockGuard
{
private:
    Mutex _mutex;
public:
    LockGuard(pthread_mutex_t *lock)
    :_mutex(lock)
    {
        _mutex.Lock();
    }
     ~LockGuard()
    {
        _mutex.Unlock();
    }
};
